package com.hhkj.study.api.user.controller;

import com.hhkj.study.api.user.model.req.*;
import com.hhkj.study.api.user.sevice.biz.ApiCustomerUserLessonBizService;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author luowu
 * @Date 2024/9/26 涵 14:20:24
 */
@RestController
@RequestMapping("/api/user/lesson")
public class ApiCustomerUseLessonController {

    @Resource
    private ApiCustomerUserLessonBizService customerUserLessonBizService;

    /**
     * 我的课程
     * @param req
     * @return
     */
    @PostMapping("/list")
    public AjaxResult courseList(@RequestBody ApiCustomerUserCourseListReq req) {
        return AjaxResult.success(customerUserLessonBizService.courseList(req));
    }

    /**
     * 所有课程类型
     * @return
     */
    @GetMapping("/type")
    public AjaxResult lessonType() {
        return AjaxResult.success(customerUserLessonBizService.lessonType());
    }

    /**
     * 课程详情
     * @param req
     * @return
     */
    @PostMapping("/detail")
    public AjaxResult courseDetail(@Validated @RequestBody ApiCustomerUserCourseBaseReq req) {
        return AjaxResult.success(customerUserLessonBizService.courseDetail(req));
    }

    /**
     * 课程表
     * @param req
     * @return
     */
    @PostMapping("/timeTable")
    public AjaxResult timeTable(@Validated @RequestBody ApiCustomerUserCourseGetReq req) {
        return AjaxResult.success(customerUserLessonBizService.timeTable(req));
    }

    /**
     * 课程表 结构
     * @param req
     * @return
     */
    @PostMapping("/structure")
    public AjaxResult structure(@Validated @RequestBody ApiCustomerUserCourseGetReq req) {
        return AjaxResult.success(customerUserLessonBizService.structure(req));
    }

    /**
     * 结构详情
     * @param req
     * @return
     */
    @PostMapping("/structure/detail")
    public AjaxResult structureDetail(@Validated @RequestBody ApiCustomerUserCourseGetReq req) {
        return AjaxResult.success(customerUserLessonBizService.structureDetail(req));
    }

    /**
     * 直播日历
     * @param req
     * @return
     */
    @PostMapping("/live/day/list")
    public AjaxResult liveDay(@Validated @RequestBody ApiUserLiveLessonDayReq req) {
        return AjaxResult.success(customerUserLessonBizService.liveDayList(req));
    }

    /**
     * 视频进度保存
     * @param req
     * @return
     */
    @PostMapping("/progress/save")
    public AjaxResult videoProgressSave(@Validated @RequestBody ApiCustomerUserListenSaveReq req) {
        return AjaxResult.success(customerUserLessonBizService.videoProgressSave(req));
    }

    /**
     * 单个视频进度
     * @param req
     * @return
     */
    @PostMapping("/video/history")
    public AjaxResult videoHistory(@Validated @RequestBody ApiCustomerUserVideoHistoryReq req) {
        return AjaxResult.success(customerUserLessonBizService.videoHistory(req));
    }

    /**
     * 学习报告
     * @param req
     * @return
     */
    @PostMapping("/study/report")
    public AjaxResult studyReport(@Validated @RequestBody ApiCustomerUserCourseBaseReq req) {
        return AjaxResult.success(customerUserLessonBizService.studyReport(req));
    }

    /**
     * 用户最近一次听课记录
     * @return
     */
    @PostMapping("/recent")
    public AjaxResult recent() {
        return AjaxResult.success(customerUserLessonBizService.recent());
    }
}
